package com.atguigu.factory.simplefactory.pizzastore.order;

import com.atguigu.factory.simplefactory.pizzastore.pizza.Pizza;

import java.util.Scanner;

public class OrderPizza {
    public static void main(String[] args) {
        while (true) {
            String type = getType();
            if ("exit".equalsIgnoreCase(type)) {
                return;
            }
            Pizza pizza = SimpleFactory.createPizza(type);
            if (null == pizza) {
                System.out.println("没有该种披萨");
                continue;
            }
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }
    }

    static String getType() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入种类：");
        String type = "";
        if (scanner.hasNextLine()) {
            type = scanner.nextLine();
        }
        return type;
    }
}
